package com.itheima.handler;

import com.itheima.common.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ClassName: GlobalHandler
 * @Description: 全局异常捕获
 * @Author: LinXiaoWei
 * @Date: 2022/6/26 18:51
 * @Version: 1.8
 */
@Slf4j
// @RestControllerAdvice
public class GlobalHandler {

    @ExceptionHandler(RuntimeException.class)
    public R businessExceptionHandler(RuntimeException e){

        return R.error("全局异常捕获");
    }
}
